home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
basnet.arc
/
IBASIC.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-02-11
|
9KB
|
239 lines
100 'set up Netware Function calls
120 gosub 10000
1000 ' This first call will open a file called test.txt as shareable RW
1010 ' 66 in HEX is 42, which, as described in DOS Tech Ref is SRW.
1020 Mode% = 66
1030 Filename$ = "test.txt"+chr$(0)
1040 def seg = libseg
1050 call xtndopn(Mode%, Filename$ , Handle%, Errcode%)
1060 def seg
1065 print "In extended open:"
1070 print "Handle =";Handle%
1080 print "Errcode =";Errcode%
1085 print
1090 input "Press ENTER to continue.";a$
1095 '======================================================================
1096 'This call will log the first byte in the file test.txt. It uses the
1097 'handle given in the previous call.
1200 HiB% = 00
1210 LoB% = 00
1220 HiL% = 00
1230 LoL% = 01
1240 Flags% = 00
1250 TimeOut% = 00
1260 def seg = libseg
1270 call PRLH.LOG(Handle%,HiB%,LoB%,HiL%,LoL%,Flags%,TimeOut%,ErrCode%)
1280 def seg
1285 print "In Physical Record Lock; Log record:"
1290 print " ErrCode =";ErrCode%
1291 print
1292 input "Press ENTER to continue.";a$
1300 '======================================================================
1310 'This call will open a semaphore called SEMA. It will give an initial
1320 'value of 5.
1850 Sema4$ = "SEMA"
1860 SemaValue% = 5
1870 def seg = libseg
1880 call OpenSem(Sema4$,SemaValue%,HiHandle%,LoHandle%,OpenCnt%,RetCode%)
1890 def seg
1900 print "Open Semaphore"
1910 print " RetCode =";RetCode%
1920 print " Low Handle =";LoHandle%
1930 print " High Handle =";HiHandle%
1940 print " Open Count =";OpenCnt%
1941 print
1942 input "Press ENTER to continue.";a$
1945 '======================================================================
2000 'This call is an example of Get Volume Stats.
2700 Vol% = 4
2710 Reply$ = chr$(99)+chr$(0)+space$(99)
2720 def seg = libseg
2730 call volstat(RetCode%,Reply$)
2740 def seg
2750 print "In Volume Stats"
2760 print " RetCode";RetCode%
2771 Print " # of sectors/block =";asc(mid$(Reply$,1,2))
2772 print " # of total blocks =";asc(mid$(Reply$,3,2))
2773 print " # of unused blocks =";asc(mid$(Reply$,5,2))
2774 print " # of dir entries =";asc(mid$(Reply$,7,2))
2775 print " # of unused dir entries =";asc(mid$(Reply$,9,2))
2776 print " Volume name is ";mid$(Reply$,11,16)
2777 print " Removable Flag =";asc(mid$(Reply$,27,2))
2779 print
2780 input "Press ENTER to continue.";a$
2790 '======================================================================
2800 'This is an example of a spool function call.
3050 LoPacLen$ = chr$(6)
3060 HiPacLen$ = chr$(0)
3070 Func$ = chr$(2)
3080 PrintFlags$ = chr$(224)
3090 TabSize$ = chr$(5)
3100 TargetPrinter$ = chr$(0)
3110 NumberCopies$ = chr$(1)
3120 FormType$ = chr$(0)
3130 ErrCode% = 0
3140 Request$=LoPacLen$+HiPacLen$+Func$+PrintFlags$+TabSize$+TargetPrinter$+NumberCopies$+FormType$
3150 Reply$=chr$(2)+chr$(0)
3160 def seg = libseg
3170 call splreq(ErrCode%,Request$,Reply$)
3180 def seg
3190 print "In Spool Request"
3200 print " Error Code =";ErrCode%
3205 print
3210 input "Press ENTER to continue.";a$
3220 '======================================================================
3230 'This function is an example of Directory Request Functions.
3235 'In particular this call will map a number to a Volume Name
3400 LoPacLen$ = chr$(2)
3410 HiPacLen$ = chr$(0)
3420 Func$ = chr$(6)
3430 VolumeNumber$ = chr$(3)
3440 ErrCode% = 0
3450 Request$=LoPacLen$+HiPacLen$+Func$+VolumeNumber$
3460 Reply$=chr$(255)+chr$(0)+space$(99)
3470 def seg = libseg
3480 call dpath(ErrCode%,Request$,Reply$)
3490 def seg
3500 print "In Directory Path"
3510 print " Error Code: ";ErrCode%
3514 print "Volume name is:";mid$(Reply$,4,asc(mid$(Reply$,3,1)))
3515 print
3520 input "Press ENTER to continue.";a$
3525 print
3530 '======================================================================
3540 'This call will Get FileServer Information
3550 LoPacLen$ = chr$(1)
3560 HiPacLen$ = chr$(0)
3570 Func$ = chr$(17) '11 Hex
3640 ErrCode% = 0
3650 Request$=LoPacLen$+HiPacLen$+Func$
3660 Reply$=chr$(138)+chr$(0)+space$(138)
3670 def seg = libseg
3680 call syslog(ErrCode%,Request$,Reply$)
3690 def seg
3700 print "In Get File Server Information"
3710 print " Error Code: ";ErrCode%
3715 print " Server Name: ";mid$(Reply$,3,48)
3730 print
3735 input "Press ENTER to continue.";A$
3740 '======================================================================
4200 'This call will get the Physical Station Number
4205 def seg = libseg
4210 call GetPSN(PSN%)
4220 def seg
4230 print "In Physical Station Number"
4240 print " PSN is : ";PSN%
5000 system
10000 '
10010 ' routines for network use
10020 '
10100 ' This section contains the routine names and
10101 ' offsets for the BASNET library
10102 ' the return is after everything is set up for NetWare calls
10110 XTNDOPN = 0 'xtndopn(Mode%, Filename$, Handle%, ErrCode%)
10111 SETATTR = 3 'setattr(Func%, Filename$, Attribute%, ErrCode%)
10112 EOJSTAT = 6 'eojstat(Flag%)
10113 PRLH.LOG = 9 'PRLH.Log(FileHandle%,HiByteOffset%,LoByteOffset%,HiLockLen%,LoLockLen%,Flags%,TimeOut%,ErrCode%)
10114 PRLH.REL = 12 'PRLH.Rel(FileHandle%,HiByteOffset%,LoByteOffset%,ErrCode%)
10115 PRLH.CLR = 15 'PRLH.Clr(FileHandle%,HiByteOffset%,LoByteOffset%,Errcode%)
10116 PRLF.LOG = 18 'PRLF.Log(fcb%,HiByteOffset%,LoByteOffset%,HiLockLen%,LoLockLen%,Flags%,TimeOut%,ErrCode%)
10117 PRLF.REL = 21 'PRLF.Rel(fcb%,HiByteOffset%,LoByteOffset%,ErrCode%)
10118 PRLF.CLR = 24 'PRLF.Clr(fcb%,HiByteOffset%,LoByteOffset%,ErrCode%)
10119 PRLS.LCK = 27 'PRLS.Lck(Flags%,TimeOut%,ErrCode%)
10120 PRLS.REL = 30 'PRLS.Rel(ErrCode%)
10121 PRLS.CLR = 33 'PRLS.Clr(ErrCode%)
10122 OPENSEM = 36 'OpenSem(Sema4$,SemaValu%,HiHandle%,LoHandle%,OpenCnt%,RetCode%)
10123 EXAMSEM = 39 'ExamSem(HiHandle%,LoHandle%,SemaValu%,OpenCnt%,RetCode%)
10124 WAITSEM = 42 'WaitSem(HiHandle%,LoHandle%,TimeOut%,RetCode%)
10125 SIGSEM = 45 'SigSem(HiHandle%,LoHandle%,RetCode%)
10126 CLOSSEM = 48 'ClosSem(HiHandle%,LoHandle%,RetCode%)
10127 SETLCK = 51 'setlck(Func%,Mode%)
10128 TTS = 54 'TTS(Func%,RetCode%)
10129 BLFTRAN = 57 'BLFtran(RetCode%)
10130 ELFTRAN = 60 'ELFtran(ReturnCode%)
10131 EXCLOG = 63 'exclog(ReturnCode%, FcbAddr)
10132 EXCLCKS = 66 'exclcks(ReturnCode%, Mode%)
10133 EXCULKF = 69 'exculkf(ReturnCode%, FcbAddr)
10134 EXCULKS = 72 'exculks(ReturnCode%)
10135 EXCCLRF = 75 'excclrf(ReturnCode%, FcbAddr)
10136 EXCCLRS = 78 'excclrs(ReturnCode%)
10137 RECLOG = 81 'reclog(ReturnCode%, String$)
10138 RECLCK = 84 'reclck(ReturnCode%, Mode%)
10139 RECULK = 87 'reculk(ReturnCode%, Semaphore$)
10140 RECULKS = 90 'reculks(ReturnCode%)
10141 RECCLR = 93 'recclr(ReturnCode%, Semaphore$)
10142 RECCLRS = 96 'recclrs(ReturnCode%)
10143 EOJ = 99 'eoj(ReturnCode%)
10144 SYSOUT = 102 'sysout(ReturnCode%)
10147 VOLSTAT = 105 'volstat(volume%, reply$)
10148 LOCDRV = 108 'locdrv(NumDisks%)
10149 WSID = 111 'wsid(ThisStationNum%)
10150 ERRMODE = 114 'errmode(mode%)
10151 BCSMODE = 117 'bcsmode(mode%)
10152 CTLSPL = 120 'ctlspl(mode%)
10153 SPLREQ = 123 'splreq(ErrCode%, RequestBlock$, Reply$)
10154 PIPREQ = 126 'pipreq(ErrCode%, RequestBlock$, Reply$)
10155 DPATH = 129 'dpath(ReturnCode%, RequestBlock$, Reply$)
10156 SYSLOG = 132 'syslog(ReturnCode%, RequestBlock$, Reply$)
10157 FATTR = 135 'fattr(ReturnCode%, FcbAddr, Attribute%)
10158 UPDFCB = 138 'updfcb(RetCode%,FcbAddr)
10159 CPYFILE = 141 'cpyfile(ReturnCode%, FcbSource, FcbDest, CountLow, CountHigh)
10160 NETTOD = 144 'nettod(time$)
10161 CLSMODE = 147 'clsmode(mode%)
10162 DRVMAP = 150 'drvmap(ReturnFlags%, drive%)
10163 RETSHL = 153 'retshl(RetCode%, Mode%)
10164 ASCLOG = 156 'asclog(RetCode%, Asciiz$)
10165 ASCULKF = 159 'asculkf(RetCode%, Asciiz$)
10166 ASCCLRF = 162 'ascclrf(RetCode%, Asciiz$)
10167 GETPSN = 165 'Get_PSN(StationNo%)
10168 GETSTA = 168 'Get_STA(Mode%,Segment%,Offset%)
10169 SETSERV = 171 'SetServ(Mode%,NewServ%,CurrServ%)
10170 MODSERV = 174 'ModServ(Mode%,NewServ%,RetCode%)
10171 GETDRV = 177 'GetDrv(Drive%)
10200 '
10210 ' Assign the segment address for the library to the variable LibSeg
10220 '
10230 def seg = 0
10240 suboff = peek(&h4f0)+(256*peek(&h4f1))
10250 subseg = peek(&h4f2)+(256*peek(&h4f3))
10260 LibSeg = subseg
10270 def seg
10280 ' be sure the resident module is in place so we don't blow up
10290 if LibSeg = 0 or suboff <> 0 then print "The resident library must be loaded before running this program.":end
10300 '
10310 ' set the error mode so its more informative
10320 def seg = LibSeg
10330 NewMode% = 1
10340 call errmode(NewMode%)
10350 def seg
10400 '
10999 return